package graphics.effects.particles;
import tools.Point;
import graphics.system.Color;
public class PSysSetting {
	enum PSYSDrawMode {
		POINTS, LINES, TEXFACE
	}
	public Color scolor, ecolor;
	public long lifetime;
	public float randomtime;
	public float randdir;
	public float shrinkspeed;
	public float size;
	public float avel;
	public float randavel;
	public boolean alignangle;
	public PSYSDrawMode dmode;
	public String texname;
	public Point gravity;
	public static PSysSetting spark;
	public static PSysSetting fire;
	public static PSysSetting rain;
	public static PSysSetting smoke;
	public static void init() {
		spark = new PSysSetting();
		spark.scolor = new Color(1, 0.8f, 0, 1);
		spark.ecolor = new Color(1, 0.4f, 0, 0);
		spark.lifetime = 500;
		spark.randomtime = 500;
		spark.randdir = 0.2f;
		spark.size = 10;
		spark.shrinkspeed = 1;
		// spark.alignangle = true;
		// spark.texname = "spark";
		spark.dmode = PSYSDrawMode.LINES;
		spark.gravity = new Point(0, -0.1f);
		fire = new PSysSetting();
		fire.scolor = new Color(1, 0.7f, 0, 1);
		fire.ecolor = new Color(-2, -5f, 0, 0);
		fire.lifetime = 2000;
		fire.randomtime = 5000;
		fire.randdir = 0.1f;
		fire.size = 50;
		fire.randavel = 100;
		fire.avel = 10;
		fire.shrinkspeed = 4;
		fire.dmode = PSYSDrawMode.TEXFACE;
		fire.texname = "fire2";
		fire.alignangle = false;
		fire.gravity = new Point(0, 0.01f);
		smoke = new PSysSetting();
		smoke.scolor = new Color(0.2f, 0.2f, 0.2f, 1);
		smoke.ecolor = new Color(0, 0, 0, -1);
		smoke.lifetime = 2000;
		smoke.randomtime = 1000;
		smoke.randdir = 0.1f;
		smoke.size = 100;
		smoke.randavel = 100;
		smoke.avel = 2;
		smoke.shrinkspeed = -2;
		smoke.dmode = PSYSDrawMode.TEXFACE;
		smoke.texname = "smoke";
		smoke.alignangle = false;
		smoke.gravity = new Point(0, 0.1f);
		rain = new PSysSetting();
		rain.scolor = new Color(0, 0.1f, 0.6f, 1);
		rain.ecolor = new Color(0, 0.1f, 0.6f, 1);
		rain.lifetime = 5000;
		rain.randomtime = 0;
		rain.randdir = 0.01f;
		rain.size = 2;
		rain.shrinkspeed = 0;
		rain.dmode = PSYSDrawMode.LINES;
		rain.gravity = new Point(0, 0);
	}
	public PSysSetting() {
	}
	public Color getColor(float progress) {
		Color c = new Color();
		c.r = (scolor.r * (1.0f - progress)) + (ecolor.r * progress);
		c.g = (scolor.g * (1.0f - progress)) + (ecolor.g * progress);
		c.b = (scolor.b * (1.0f - progress)) + (ecolor.b * progress);
		c.a = (scolor.a * (1.0f - progress)) + (ecolor.a * progress);
		return c;
	}
}
